import * as fgui from "fairygui-cc";
import { ItemVO } from "../../../vo/ItemVO";
import { ExternalGLoader } from "../../../../../Core/Layer/ExternalGLoader";
export class SkillItemRender extends fgui.GButton {
    public vo: ItemVO;
    private countTxt: fgui.GTextField;
    private iconUrl: ExternalGLoader;
    private nameTxt: fgui.GTextField;
    protected onConstruct(): void {
        this.countTxt = this.getChild(`countTxt`) as fgui.GTextField;
        this.iconUrl = this.getChild(`iconUrl`) as ExternalGLoader;
        this.nameTxt = this.getChild(`nameTxt`) as fgui.GTextField;
    }
    public setDate(vo: ItemVO, count: number): void {
        this.vo = vo;
        this.iconUrl.url = `item/${vo.cfg.icon}.png`;
        this.setCountTxt(count);
        this.nameTxt.text = `${vo.cfg.name}`;
    }
    public setCountTxt(value: number): void {
        this.countTxt.text = `${value}`;
    }
    public get count(): number {
        return Number(this.countTxt.text);
    }
}